<?php
declare (strict_types = 1);
namespace app\admin\controller;
use app\BaseController;
use app\common\model\TaskLogModel;
class TaskLog extends BaseController
{
    public function index()
    {	
    	if($this->request->isPost()){
    		$search = $this->request->post('search');
    		$taskid = $this->request->get('taskid');
			$where=[];
			if(!empty($search)){
			    if (isset($search['name'])){
                    $this->jsonjqgrid('','','','请填写要查询的任务名称');
                }
				$where[] = ['b.name','LIKE',$search['name']."%"];
			}
			if(!empty($taskid)){
				$where[] = ['b.id','=',$taskid];
			}

    		$list = TaskLogModel::alias('a')->where($where)->leftJoin('task b','a.tid= b.id')->field('a.*,b.name')->paginate();

    		$this->jsonjqgrid($list->items(),$list->total());
    	}
        return $this->fetch();
    }
}
